package com.tangpian.sna.core.analysis.lda.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import com.tangpian.sna.core.model.Result;

/**
 * id从0开始
 * 
 * @author shydow
 * 
 */
@Entity
public class Topic extends Result {
	@Id
	private int id;
	@Column(length=1000)
	private String keywords;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public void addKeyword(String word, double probability) {
		if (word != null) {
			keywords += word + " " + probability + "\n";
		}
	}
	
	public void addKeyword(String keyword) {
		if (keyword != null) {
			keywords += keyword + "\n";
		}
	}

}
